package com.itheima.advantagesup.service.impl;

import com.itheima.advantagesup.entity.SysMenu;
import com.itheima.advantagesup.mapper.MenuMapper;
import com.itheima.advantagesup.service.MenuService;
import com.itheima.advantagesup.vo.MenuVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

import java.util.List;

import java.util.List;

@Service
public class MenuServiceImpl implements MenuService {

    @Autowired
    private MenuMapper menuMapper;


    /**
     * 更新菜单
     *
     * @param sysMenu 系统菜单
     */
    @Override
    public void updateMenu(SysMenu sysMenu) {
        SysMenu menu = new SysMenu();
        BeanUtils.copyProperties(sysMenu , menu);

        sysMenu.setUpdateDate(LocalDateTime.now());
        menuMapper.updateMenu(menu);


    }

    /**
     * 查询系统菜单通过id
     *
     * @param id id
     * @return {@link SysMenu}
     */
    @Override
    public SysMenu querySysMenuById(Integer id) {
        SysMenu sysMenu = menuMapper.seleteSysMenuById(id);
        return sysMenu;
    }


}
